import request from '@/utils/axios/axios-service.ts'

/**
 * 管理员充值接口
 */
export const rechargeAdminList = (params: any) => request.get('/finance/admin_recharge/list', {params: params})
export const rechargeAdminSubmit = (params: any) => request.post('/finance/admin_recharge/submit', params)
export const rechargeAdminBatchSubmit = (params: any) => request.post('/finance/admin_recharge/batch_submit', params)
export const rechargeAdminClearAll = () => request.post('/finance/admin_recharge/clear_all')
export const rechargeAdminClear = (params: any) => request.post('/finance/admin_recharge/clear', params)
export const rechargeAdminConfig = () => request.get('/finance/admin_recharge/config')

/**
 * 提现配置接口
 */
export const withdrawConfigList = (params: any) => request.get('/withdraw/config/list', {params: params})
export const withdrawConfigInfo = (id: number) => request.get('/withdraw/config/info/' + id)
export const withdrawConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/withdraw/config/create' : '/withdraw/config/update', params)
export const withdrawConfigs = () => request.get('/withdraw/config/all')

/**
 * 提现申请记录
 */
export const withdrawRecordList = (params: any) => request.get('/withdraw/record/list', {params: params})
export const withdrawRecordInfo = (id: number) => request.get('/withdraw/record/info/' + id)
export const withdrawRecordAudit = (params: any) => request.post('/withdraw/record/audit', params)

/**
 * 转账配置接口
 */
export const transferConfigList = (params: any) => request.get('/transfer/config/list', {params: params})
export const transferConfigInfo = (id: number) => request.get('/transfer/config/info/' + id)
export const transferConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/transfer/config/create' : '/transfer/config/update', params)
export const transferConfigs = () => request.get('/transfer/config/all')

export type WithdrawConfig = {
  id: number;
  open: boolean;
  type: number;
  name: string;
  poundage_ratio: number;
  poundage_fee_min: number;
  poundage_fee_max: number;
  single_min_amount: number;
  single_max_amount: number;
  limit_type: number;
  limit_max_count: number;
  limit_max_amount: number;
  open_rules: string;
  explained: string;
};

export type WithdrawRecord = {
  id: number;
  status: number;
  user_id: number;
  type: number;
  amount: number;
  actual_amount: number;
  poundage_fee: number;
  poundage_ratio: number;
  capital_data: string;
  account_type: number;
  alipay_name: string;
  alipay_account: string;
  holder: string;
  card_no: string;
  bank_name: string;
  audit_time: string;
  audit_reason: string;
  create_time: string;
  update_time: string;
  payment_channel_type: number;
  payment_trade_time: string; // 打款时间
  payment_trade_no: string; // 打款订单号
  payment_trade_desc: string; // 打款结果描述
  payment_result: string; // 打款响应数据
};

export type TransferConfig = {
  id: number;
  open: boolean;
  type: number;
  name: string;
};
